package cn.player.media.timeshift;

import android.widget.HorizontalScrollView;

import cntv.player.engine.Const;

/**
 * 时移参数
 *
 * @author xjs
 */
public class TimeShiftParams {
    private HorizontalScrollView mainLayout;

    /**
     * 刻度每一小格 600秒(10分钟)
     */
    public int littleGrid;
    /**
     * 刻度每一大格 有多少个小格 默认6不格 3600秒(1小时)
     */
    public int bigGrid;

    /**
     *
     */
    public int seekPoint;

    /**
     * 每个像素点代表几秒；
     */
    public int dpToDate;

    /**
     * 需要绘出多少天的时移 (当前一天24小时,往前绘减去24小时的)
     */
    public int dayToCanvas;
    /**
     * 需要绘出多少小时的时移 (当前一天24小时,往前绘减去24小时的)
     */
    public int hourToCanvas;

    /**
     * 需要绘出多少秒的时移 (当前一天24小时,往前绘减去24小时的)
     */
    public int secondToCanvas;

    /**
     * 区分天 小时 分钟
     */
    public int unitType;

    public TimeShiftParams(HorizontalScrollView main) {
        this.mainLayout = main;
        setSecond();
    }

    public void setDay() {
        littleGrid = 4 * 60 * 60;
        bigGrid = 6;
        seekPoint = 1;
        dayToCanvas = 7;//绘制7天时间
        hourToCanvas = dayToCanvas * 24;
        secondToCanvas = hourToCanvas * 60 * 60;//绘制7天时间
        dpToDate = secondToCanvas / mainLayout.getWidth();
        unitType = Const.TIME_SHIFT_FOR_DAY;
    }

    public void setHour() {
        littleGrid = 1 * 60 * 60;
        bigGrid = 6;
        seekPoint = 1;
        dayToCanvas = 7;//绘制7天时间
        hourToCanvas = dayToCanvas * 24;
        secondToCanvas = hourToCanvas * 60 * 60;//绘制7天时间
        dpToDate = 1 * 60;
        unitType = Const.TIME_SHIFT_FOR_HOUR;
    }

    public void setSecond() {
        littleGrid = 10 * 60;
        bigGrid = 6;
        seekPoint = 1;
        dayToCanvas = 1;//绘制当天
        hourToCanvas = dayToCanvas * 24;
        secondToCanvas = hourToCanvas * 60 * 60;//绘制1天时间
        dpToDate = 5;
        unitType = Const.TIME_SHIFT_FOR_SECOND;
    }
}
